package com.example.experiment2;

import android.content.ComponentName;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {

    Button toUC1,toUC2,toUC3,toUC4,toUC5;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        toUC1=findViewById(R.id.UC1);
        toUC2=findViewById(R.id.UC2);
        toUC3=findViewById(R.id.UC3);
        toUC4=findViewById(R.id.UC4);
        toUC5=findViewById(R.id.UC5);
        toUC1.setOnClickListener(new ViewOnClick());
        toUC2.setOnClickListener(new ViewOnClick());
        toUC3.setOnClickListener(new ViewOnClick());
        toUC4.setOnClickListener(new ViewOnClick());
        toUC5.setOnClickListener(new ViewOnClick());
    }

    class ViewOnClick implements View.OnClickListener{
        @Override
        public void onClick(View v) {
            Intent intent=new Intent();
            switch (v.getId()){
                case R.id.UC1:
                    intent.setClass(MainActivity.this,UC1.class);
                    startActivity(intent);
                    break;
                case R.id.UC2:
                    intent.setClass(MainActivity.this,UC2.class);
                    startActivity(intent);
                    break;
                case R.id.UC3:
                    intent.setClass(MainActivity.this,UC3.class);
                    startActivity(intent);
                    break;
                case R.id.UC4:
                    intent.setClass(MainActivity.this,UC4.class);
                    startActivity(intent);
                    break;
                case R.id.UC5:
                    intent.setClass(MainActivity.this,UC5.class);
                    startActivity(intent);
                    break;
            }
        }
    }

}
